#!/usr/bin/env node

/**
 * 步骤3测试：填写个人信息（选择DI服务 + 填写表单，两个状态都要记录HTML）
 */

import { spawn } from 'node:child_process'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const projectRoot = join(__dirname, '..')
const testFile = join(projectRoot, 'scripts', 'test-step-03-personal-info.ts')

const proc = spawn('npx', ['tsx', '--tsconfig', join(projectRoot, 'tsconfig.node.json'), testFile], {
  cwd: projectRoot,
  stdio: 'inherit',
  shell: true,
})

proc.on('close', (code) => process.exit(code || 0))
proc.on('error', (error) => {
  console.error('执行失败:', error)
  process.exit(1)
})

